package com.ymatou.iapi.godfreight.service;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymatou.iapi.coupon.parameter.CouponInfo;
import com.ymatou.iapi.godfreight.parameter.CalcOrderFreightResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
/**
*代购神器计算订单运费Call
*FreeMaker Template自动生成代码
*/
public class CalcOrderFreightCall extends YmatouBaseCall{
	private static String opurl ="/calcOrderFreight";
	
	public CalcOrderFreightCall() {
		super(EnvSetup.getSystemUrl("godfreight_api"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	

    public String getData()
    {
        return getString("data");
    }
    
	public String getSuccess() throws JSONException
    {
        return  getString("success");
    }
	
	public String getErrorCode() throws JSONException
    {
        return getString("errorCode");
    }

    public String getMessage() throws JSONException
    {
        return  getString("errorMessage");
    }
    
    public CalcOrderFreightResp getOrderDtos()
    {
    	CalcOrderFreightResp data = null;
        try {
            data =
                    (CalcOrderFreightResp) FormatUtil.GSONToObject(
                    		getData(),CalcOrderFreightResp.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}